const express = require("express");
const router = express.Router();
const path = require("path");
const { compress } = require("../script/compress");
const { captureAreticle } = require("../script/capture-article");
const { removePublic } = require("../script/rm-public");
router.get("/", async (req, res, next) => {
	let totalPage = req.query.totalPage || 1;
	console.log(totalPage);
	try {
		await removePublic();
		await captureAreticle(totalPage);
		await compress();
		res.sendFile(path.resolve(__dirname, "../public/xinxin.zip"));
	} catch (error) {
		res.send("err");
	}
});

module.exports = router;
